package com.woniuxy.store.app.apiImpl;

import cn.hutool.core.bean.BeanUtil;
import com.woniuxy.store.client.PackageQueryClient;
import com.woniuxy.store.client.result.PackageDto;
import com.woniuxy.store.infra.model.Package;
import com.woniuxy.store.service.PackageService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import result.Result;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping(("/store/contract"))
public class PackageQueryClientImpl implements PackageQueryClient {

    @Resource
    private PackageService packageService;
    @Override
    public Result<List<PackageDto>> allPackage() {
        List<Package> list = packageService.list();
        List<PackageDto> dtos = BeanUtil.copyToList(list, PackageDto.class);
        return Result.success(dtos);
    }




}
